package com.ruoyi.ManagerApi.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.datascope.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ManagerApi.mapper.FactoryManagementMapper;
import com.ruoyi.ManagerApi.domain.FactoryManagement;
import com.ruoyi.ManagerApi.service.IFactoryManagementService;

import static com.ruoyi.common.security.utils.SecurityUtils.getLoginUser;

/**
 * 厂家管理Service业务层处理
 * 
 * @author li
 * @date 2025-09-17
 */
@Service
public class FactoryManagementServiceImpl implements IFactoryManagementService 
{
    @Autowired
    private FactoryManagementMapper factoryManagementMapper;

    /**
     * 查询厂家管理
     * 
     * @param id 厂家管理主键
     * @return 厂家管理
     */
    @Override
    public FactoryManagement selectFactoryManagementById(Long id)
    {
        return factoryManagementMapper.selectFactoryManagementById(id);
    }

    /**
     * 查询厂家管理列表
     * 
     * @param factoryManagement 厂家管理
     * @return 厂家管理
     */
    @Override
    public List<FactoryManagement> selectFactoryManagementList(FactoryManagement factoryManagement)
    {
        return factoryManagementMapper.selectFactoryManagementList(factoryManagement);
    }

    /**
     * 新增厂家管理
     * 
     * @param factoryManagement 厂家管理
     * @return 结果
     */
    @Override
    public int insertFactoryManagement(FactoryManagement factoryManagement)
    {
        factoryManagement.setCreateBy(getLoginUser().getUsername());
        factoryManagement.setCreateTime(DateUtils.getNowDate());
        return factoryManagementMapper.insertFactoryManagement(factoryManagement);
    }

    /**
     * 修改厂家管理
     * 
     * @param factoryManagement 厂家管理
     * @return 结果
     */
    @Override
    public int updateFactoryManagement(FactoryManagement factoryManagement)
    {
        factoryManagement.setUpdateBy(getLoginUser().getUsername());
        factoryManagement.setUpdateTime(DateUtils.getNowDate());
        return factoryManagementMapper.updateFactoryManagement(factoryManagement);
    }

    /**
     * 批量删除厂家管理
     * 
     * @param ids 需要删除的厂家管理主键
     * @return 结果
     */
    @Override
    public int deleteFactoryManagementByIds(Long[] ids)
    {
        return factoryManagementMapper.deleteFactoryManagementByIds(ids);
    }

    /**
     * 删除厂家管理信息
     * 
     * @param id 厂家管理主键
     * @return 结果
     */
    @Override
    public int deleteFactoryManagementById(Long id)
    {
        return factoryManagementMapper.deleteFactoryManagementById(id);
    }
}
